package com.kx.simple_factory_mode;

/**
 * Created on 2021/10/14.
 *
 * @author KaiXuan Xiao
 */
public class OperationFactory {
    public static Operation createOperation(String opera){
        Operation operation = null;
        switch (opera){
            case "+":
                operation = new OperationAdd();
                break;
            case "-":
                operation = new OperationSub();
                break;
            case "*":
                operation = new OperationMul();
                break;
            case "/":
                operation = new OperationDiv();
                break;
        }
        return operation;
    }
}
